package com.googlecode.kipler.satisfiability.completion.rule.formula.uniformnotation;

import com.googlecode.kipler.syntax.formula.BooleanFormula;
import com.googlecode.kipler.syntax.formula.Formula;
import com.googlecode.kipler.syntax.formula.BooleanFormula.Operator;

public class AndAlphaFormula implements AlphaFormula {
	
	private BooleanFormula andF;

	private Formula alpha1, alpha2;

	private boolean valid;

	public AndAlphaFormula() {
		super();
	}

	public AndAlphaFormula(Formula f) {
		setAlpha(f);
	}

	@Override
	public void setAlpha(Formula f) {
		valid = false;
		if (f instanceof BooleanFormula) {
			andF = (BooleanFormula) f;
			if (andF.getOperator() == Operator.AND) {
				alpha1 = andF.getLhs();
				alpha2 = andF.getRhs();
				valid = true;
			}
		}
	}

	@Override
	public Formula getAlpha1() {
		return alpha1;
	}

	@Override
	public Formula getAlpha2() {
		return alpha2;
	}

	public boolean isValid() {
		return valid;
	}

}
